<% activities.each do |activity| %>
<% topic = Topic.find( activity.id ) %>
  <div class="section">
    <div class="item">
      <h3><%= link_to  "#{topic.title}" , :controller=>"topics" , :action=>"show" , :id=>topic.id  %></h3>
      <div class="type"> <%=h activity.state %> </div>
      <div class="description"><%=h topic.topic_content %></div>
      <div class="p">
      	<table width="500" border="0">
  	  <tr>
            <td><img src="images/starter.jpg"/><%=h topic.user.account %></td>
            <td><img src="images/time.jpg"/><%=h topic.created_at %></td>
  	  </tr>
	</table>

      </div>
      <div class="p">
        <table width="240" border="0">
  	  <tr>
    	    <td>
              <% if activity.state == "进行时" %>
                <% form_remote_tag :url=>{ :controller=>"activity", :action=>"close_activity", :id=>topic.id } do  %>
                <%= submit_tag " 活动结束 " %>
                <% end %>
              <% end %>
            </td>
          </tr>
        </table>
      </div>
    </div>
  </div>
<%end%>
